
package fileby.gui.sidebar;

import com.google.inject.Inject;
import fileby.core.IDisplayableFile;
import fileby.core.SourceType;
import fileby.ctrl.sidebar.ISideBarItemListenerProvider;
import fileby.ctrl.actions.IActionProvider;
import fileby.ctrl.transferhandlers.ITransferHandlerProvider;
import fileby.util.properties.IPropertyBundleProvider;
import javax.swing.JPanel;

/**
 *
 * @author Jacob
 */
public class SideBarFactory implements ISideBarProvider{

    private IPropertyBundleProvider propertyBundleProvider;
    private ITransferHandlerProvider transferHandlerProvider;
    private ISideBarItemListenerProvider listenerProvider;
    private IActionProvider actionProvider;
    
    @Inject
    public SideBarFactory(IPropertyBundleProvider propertyBundleProvider,
            ITransferHandlerProvider transferHandlerProvider,
            ISideBarItemListenerProvider listenerProvider,
            IActionProvider actionProvider) {

        this.propertyBundleProvider = propertyBundleProvider;
        this.transferHandlerProvider = transferHandlerProvider;
        this.listenerProvider = listenerProvider;
        this.actionProvider = actionProvider;
    }
    
    public SideBarPanel createPanel(SourceType type) {
        return new SideBarPanel(type, this, propertyBundleProvider, transferHandlerProvider);
    }

    public JPanel createItem(IDisplayableFile displayableFile, SourceType type) {
        return new SideBarPanelItem(displayableFile,type,propertyBundleProvider,
                listenerProvider, actionProvider);
    }

}
